﻿@model AutomatedTestDataManagement.Models.TestTestStep

@{
    ViewBag.Title = "Create";
}

<h2>Add Test Step to Test</h2>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>TestTestStep</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.TestID, "Test")
            @if (ViewBag.ScenarioID != null)
            {
                <input type="hidden" name="ScenarioID" id="ScenarioID" value="@ViewBag.ScenarioID" />
            }
            @if (ViewBag.SuiteID != null)
            {
                <input type="hidden" name="SuiteID" id="SuiteID" value="@ViewBag.SuiteID" />
            }
        </div>
        <div class="editor-field">
            @Html.DropDownList("TestID", String.Empty)
            @Html.ValidationMessageFor(model => model.TestID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.TestStepID, "Test Step")
        </div>
        <div class="editor-field">
            @Html.DropDownList("TestStepID", String.Empty)
            @Html.ValidationMessageFor(model => model.TestStepID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StepNumber, "Step Number")
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.StepNumber, new { @Value = ViewBag.StepNumber.ToString() })
            @Html.ValidationMessageFor(model => model.StepNumber)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @if (ViewBag.ScenarioID != null)
    {
        if (ViewBag.SuiteID != null)
        {
            @Html.ActionLink("Add new Test Step", "Create", new { id = ViewBag.SelectedTestID, scenarioID = ViewBag.ScenarioID, suiteID = ViewBag.SuiteID }, null)

           @Html.ActionLink("Return to Test", "Edit", "Test", new { id = ViewBag.SelectedTestID, scenarioID = ViewBag.ScenarioID, suiteID = ViewBag.SuiteID }, null)
        }
        else
        {
           @Html.ActionLink("Add new Test Step", "Create", new { id = ViewBag.SelectedTestID, scenarioID = ViewBag.ScenarioID }, null)

          @Html.ActionLink("Return to Test", "Edit", "Test", new { id = ViewBag.SelectedTestID, scenarioID = ViewBag.ScenarioID }, null)
        }
    }
    else
    {
        @Html.ActionLink("Add new Test Step", "Create", "TestStep", new { id = ViewBag.SelectedTestID }, null)

        @Html.ActionLink("Return to Test", "Edit", "Test", new { id = ViewBag.SelectedTestID }, null)
    }
    @Html.Partial("_TestSuiteNav")

</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
